import smtplib
from email.mime.text import MIMEText
from email.header import Header


def my_send_email(title, content_html, from_email, to_email):
	# 邮件内容
	message = MIMEText(content_html, 'html', 'utf-8')

	# 邮件信息
	message['Subject'] = Header(title, 'utf-8')
	message['From'], message['To'] = from_email, to_email

	# 使用QQ邮箱的服务，发送邮件
	smtpObj = smtplib.SMTP_SSL("smtp.qq.com", 465)
	smtpObj.login(from_email, "hidrnhkxpoffbbgb")
	smtpObj.sendmail(from_email, [to_email], message.as_string())
	smtpObj.quit()


my_send_email("来自Python的测试邮件",
			  "内容：来自Python的测试邮件",
			  "693609645@qq.com",
			  "693609645@qq.com")
